<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta name="Content-Type" content="text/html; charset=UTF-8" />
<title>Class: Sass::CSS</title>
<link rel="stylesheet" href="style.css" tppabs="http://sass-lang.com/docs/yardoc/css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="common.css" tppabs="http://sass-lang.com/docs/yardoc/css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '..';
  if (relpath != '') relpath += '/';
</script>
<script type="text/javascript" charset="utf-8" src="jquery.js" tppabs="http://sass-lang.com/docs/yardoc/js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="app.js" tppabs="http://sass-lang.com/docs/yardoc/js/app.js"></script>

  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="_index.html" tppabs="http://sass-lang.com/docs/yardoc/_index.html">Index (C)</a> &raquo; 
    <span class='title'><a href="Sass-1.html" tppabs="http://sass-lang.com/docs/yardoc/Sass.html" title="Sass (module)">Sass</a></span>
     &raquo; 
    <span class="title">CSS</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="javascript:if(confirm(%27http://sass-lang.com/docs/yardoc/Sass/.  \n\nThis file was not retrieved by Teleport Pro, because the server reports that this file cannot be found.  \n\nDo you want to open it from the server?%27))window.location=%27http://sass-lang.com/docs/yardoc/Sass/.%27" tppabs="http://sass-lang.com/docs/yardoc/Sass/." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  <a id="class_list_link" href="#">Class List</a>
  <a id="method_list_link" href="#">Method List</a>
  <a id ="file_list_link" href="#">File List</a>
</div>

      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Class: Sass::CSS 
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">Sass::CSS</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">/var/www/sass-pages/.sass/lib/sass/css.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>This class converts CSS documents into Sass or SCSS templates. It works by parsing the CSS document into a <tt><a href="Tree.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Tree.html" title="Sass::Tree (module)">Sass::Tree</a></tt> structure, and then applying various transformations to the structure to produce more concise and idiomatic Sass/SCSS.</p>

<p>Example usage:</p>

<pre class="code">Sass::CSS.new(&quot;p { color: blue }&quot;).render(:sass) #=&gt; &quot;p\n  color: blue&quot;
Sass::CSS.new(&quot;p { color: blue }&quot;).render(:scss) #=&gt; &quot;p {\n  color: blue; }&quot;</pre>

  </div>
</div>
<div class="tags">
  
</div>


  <h2>Instance Method Summary</h2>

  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (CSS) <strong>initialize</strong>(template, options = {}) </a>
    

    
  </span>
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  

  
    <span class="summary_desc">A new instance of CSS.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#render-instance_method" title="#render (instance method)">- (String) <strong>render</strong>(fmt = :sass) </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">Converts the CSS template into Sass or SCSS code.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#source_encoding-instance_method" title="#source_encoding (instance method)">- (Encoding<sup>?</sup>) <strong>source_encoding</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">Returns the original encoding of the document, or <code>nil</code> under Ruby 1.8.</span>
  
</li>

    
  </ul>
<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <p class="signature first" id="initialize-instance_method">
  
    - (<tt><a href="" title="Sass::CSS (class)">CSS</a></tt>) <strong>initialize</strong>(template, options = {}) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>A new instance of CSS</p>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
        <span class='name'>template</span>
      
      
      
        &mdash;
        The CSS stylesheet. This stylesheet can be encoded using any encoding that can be converted to Unicode. If the stylesheet contains an <code>@charset</code> declaration, that overrides the Ruby encoding (see <a href="file.SASS_REFERENCE.html#encodings" tppabs="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#encodings" title="the encoding documentation">the encoding documentation</a>)
      
    </li>
  
</ul>

  
    
    
    
    
    <h3>Options Hash (<tt>options</tt>):</h3>
    <ul class="option">
      
        <li>
          <span class="type">(<tt>Boolean</tt>)</span>
          <span class="name">:old</span>
          <span class="default">
            
              &mdash; default:
              <tt>false</tt>
            
          </span>
          &mdash;Whether or not to output old property syntax (<code>:color blue</code> as opposed to <code>color: blue</code>). This is only meaningful when generating Sass code, rather than SCSS.
        </tr>
      
        <li>
          <span class="type">(<tt>String</tt>)</span>
          <span class="name">:indent</span>
          <span class="default">
            
              &mdash; default:
              <tt>&quot;  &quot;</tt>
            
          </span>
          &mdash;The string to use for indenting each line. Defaults to two spaces.
        </tr>
      
    </ul>
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


29
30
31
32
33
34
35
36
37
38</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/css.rb', line 29</span>

def initialize(template, options = {})
  if template.is_a? IO
    template = template.read
  end

  @options = options.dup
  # Backwards compatibility
  @options[:old] = true if @options[:alternate] == false
  @template = template
end</pre>
    </td>
  </tr>
</table>
</div>
  
</div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="render-instance_method">
  
    - (<tt>String</tt>) <strong>render</strong>(fmt = :sass) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Converts the CSS template into Sass or SCSS code.</p>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt>Symbol</tt>)</span>
      
      
        <span class='name'>fmt</span>
      
      
        <em class="default">(defaults to: <tt>:sass</tt>)</em>
      
      
        &mdash;
        <code>:sass</code> or <code>:scss</code>, designating the format to return.
      
    </li>
  
</ul>
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
      
        &mdash;
        The resulting Sass or SCSS code
      
    </li>
  
</ul>
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
        <span class='type'>(<tt><a href="SyntaxError.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/SyntaxError.html" title="Sass::SyntaxError (class)">Sass::SyntaxError</a></tt>)</span>
      
      
      
      
        &mdash;
        if there&#8217;s an error parsing the CSS template
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


45
46
47
48
49
50
51</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/css.rb', line 45</span>

def render(fmt = :sass)
  check_encoding!
  build_tree.send("to_#{fmt}", @options).strip + "\n"
rescue Sass::SyntaxError => err
  err.modify_backtrace(:filename => @options[:filename] || '(css)')
  raise err
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="source_encoding-instance_method">
  
    - (<tt>Encoding</tt><sup>?</sup>) <strong>source_encoding</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Returns the original encoding of the document, or <code>nil</code> under Ruby 1.8.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>Encoding</tt>, <tt>nil</tt>)</span>
      
      
      
      
    </li>
  
</ul>
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
        <span class='type'>(<tt>Encoding::UndefinedConversionError</tt>)</span>
      
      
      
      
        &mdash;
        if the source encoding cannot be converted to UTF-8
      
    </li>
  
    <li>
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
      
        &mdash;
        if the document uses an unknown encoding with <code>@charset</code>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


60
61
62
63</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/css.rb', line 60</span>

def source_encoding
  check_encoding!
  @original_encoding
end</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Fri Mar  8 20:33:41 2013 by 
  <a href="javascript:if(confirm(%27http://yardoc.org/  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://yardoc.org/%27" tppabs="http://yardoc.org/" title="Yay! A Ruby Documentation Tool">yard</a>
  0.5.3 (ruby-1.8.7).
</div>


  <script type="text/javascript">
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  </script>
  <script type="text/javascript">
  try {
  var pageTracker = _gat._getTracker("UA-535380-8");
  pageTracker._trackPageview();
  } catch(err) {}</script>


  </body>
</html>